import React, { Component } from 'react'
import axios from 'axios'
export default class index extends Component {
  getData = () => {
    axios.get('http://localhost:3000/api1/students').then(res => {
      console.log(res.data);
    }, err => {
      console.error(err);
    })
  }
  getData2 = () => {
    axios.get('http://localhost:3000/api2/cars').then(res => {
      console.log(res.data);
    }, err => {
      console.error(err);
    })
  }
  render() {
    return (
      <div>
        <button onClick={this.getData}>获取数据1</button>
        <button onClick={this.getData2}>获取数据2</button>

      </div>
    )
  }
}
